$(function() {
	//初始化datatable
	$("#table").XRDataTable({
		ajaxUrl: "Admin/QualityReport/getDatas",
		paramFunc: paramFunc,
		operation: {
			"icon-signin": [printAttend1,'质量监控与评价报告',false,900],
			"edit": ["Admin/QualityReport/edit/#id","编辑报告年月",false,800],			
			"del": [ del,"启用/冻结"]
		},
		hasCheckbox: false
	});

	// exportEvent();
	
});

var paramFunc = function() {
	var data = getFormJson();
	return data;
};


var del=function(idx, trData){
	var id=$("#id").val();
	swal({
		title: "请确认",
		text: "是否确认删除【" + trData.start_month + "至" + trData.end_month + "的质量监控与评价报告】?",
		type: "warning",
		showCancelButton: true,
		closeOnConfirm: true,
		confirmButtonText: "确定",
		cancelButtonText: '取消',
		confirmButtonColor: "#ec6c62"
	}, function(isConfirm) {
		if(isConfirm) {
			$.ajax({
				type: "post",
				url: $("#url").val()+'Admin/QualityReport/delete/'+trData.id,
				async: true,
				success: function(data) {
					var ret = $.parseJSON(data);
					if(ret.status) {
	                    window.parent.topMessagePrompt('success',ret.msg);
	                    window.parent.refreshTable();
					} else {
						window.parent.topMessagePrompt('error',ret.msg);
					}
				}
			});
		}
	});
}
// function imgBigshow(t){
// 	imgBig($(t).attr('class'));
// }
var printAttend1 = function(idx, trData){

	showDialogModal("Admin/QualityReport/exportQualityWord/"+trData.id,"1024","700");
	
}